package com.anti.modular.bus.busroomconfiguration.controller;

import com.anti.commom.annotation.BusinessLog;
import com.anti.commom.annotation.Permission;
import com.anti.commom.enums.LogAnnotionOpTypeEnum;
import com.anti.commom.api.Result;
import com.anti.jdbc.support.page.PageParam;
import com.anti.jdbc.support.page.PageParam;
import com.anti.modular.bus.busroomconfiguration.param.BusRoomConfigurationParam;
import com.anti.modular.bus.busroomconfiguration.service.BusRoomConfigurationService;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;

import javax.annotation.Resource;

/**
 * 房间家私配置控制器
 *
 * @author AnTi
 * @date 2021-04-07 21:09:17
 */
@RestController
@RequestMapping("busRoomConfiguration")
public class BusRoomConfigurationController {

    @Resource
    private BusRoomConfigurationService busRoomConfigurationService;

    /**
     * 查询房间家私配置
     *
     * @author AnTi
     * @date 2021-04-07 21:09:17
     */
    @GetMapping("page")
    @BusinessLog(title = "房间家私配置_查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public Result page(PageParam pageParam, BusRoomConfigurationParam busRoomConfigurationParam) {
        return Result.data(busRoomConfigurationService.page(pageParam,busRoomConfigurationParam));
    }

    /**
     * 添加房间家私配置
     *
     * @author AnTi
     * @date 2021-04-07 21:09:17
     */
    @Permission
    @PostMapping("add")
    @BusinessLog(title = "房间家私配置_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public Result add(@RequestBody @Validated(BusRoomConfigurationParam.add.class) BusRoomConfigurationParam busRoomConfigurationParam) {
            busRoomConfigurationService.add(busRoomConfigurationParam);
        return Result.success("新增成功");
    }

    /**
     * 删除房间家私配置
     *
     * @author AnTi
     * @date 2021-04-07 21:09:17
     */
    @Permission
    @PostMapping("delete")
    @BusinessLog(title = "房间家私配置_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public Result delete(@RequestBody @Validated(BusRoomConfigurationParam.delete.class) BusRoomConfigurationParam busRoomConfigurationParam) {
            busRoomConfigurationService.delete(busRoomConfigurationParam);
        return Result.success("删除成功");
    }

    /**
     * 编辑房间家私配置
     *
     * @author AnTi
     * @date 2021-04-07 21:09:17
     */
    @Permission
    @PostMapping("edit")
    @BusinessLog(title = "房间家私配置_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public Result edit(@RequestBody @Validated(BusRoomConfigurationParam.edit.class) BusRoomConfigurationParam busRoomConfigurationParam) {
            busRoomConfigurationService.edit(busRoomConfigurationParam);
        return Result.success("修改成功");
    }

    /**
     * 查看房间家私配置
     *
     * @author AnTi
     * @date 2021-04-07 21:09:17
     */
    @GetMapping("detail")
    @BusinessLog(title = "房间家私配置_查看", opType = LogAnnotionOpTypeEnum.DETAIL)
    public Result detail(@Validated(BusRoomConfigurationParam.detail.class) BusRoomConfigurationParam busRoomConfigurationParam) {
        return Result.data(busRoomConfigurationService.detail(busRoomConfigurationParam));
    }

    /**
     * 房间家私配置列表
     *
     * @author AnTi
     * @date 2021-04-07 21:09:17
     */
    @GetMapping("list")
    @BusinessLog(title = "房间家私配置_列表", opType = LogAnnotionOpTypeEnum.QUERY)
    public Result list(BusRoomConfigurationParam busRoomConfigurationParam) {
        return Result.data(busRoomConfigurationService.list(busRoomConfigurationParam));
    }

}
